Skip to content

tests/record: Compare request body in plain text if content-type: text/plain is used #6326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Apr 13, 2023

This PR builds upon #6318 and makes it easier to work with HTTP request recordings that are using a text/plain content type header. In this case we will assume the content is utf8-encoded and compare the strings directly, instead of using base64 encoding.

@Turbo87 Turbo87 requested a review from arlosi April 13, 2023 11:55
@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Apr 13, 2023
@Turbo87 Turbo87 force-pushed the plaintext-recorder branch from 3d93a8a to 9ed64af Compare April 13, 2023 12:28
@Turbo87 Turbo87 merged commit a2d2bd7 into rust-lang:master Apr 14, 2023
@Turbo87 Turbo87 deleted the plaintext-recorder branch April 14, 2023 06:29
LawnGnome added a commit to LawnGnome/crates.io that referenced this pull request Jun 13, 2023
In rust-lang#6326, `text/plain` request payloads were decoded into... well, plain
text, and `record::replay_http` was updated to handle them accordingly.
The code that records those request payloads was not updated, however,
so any updated test payload will now result in failures, since a
base64 encoded string will be compared against a plain text string.

This adds the same logic to `record::record_http` to ensure newly
recorded cassettes match.
Turbo87 pushed a commit that referenced this pull request Jun 13, 2023
…#6603)

In #6326, `text/plain` request payloads were decoded into... well, plain
text, and `record::replay_http` was updated to handle them accordingly.
The code that records those request payloads was not updated, however,
so any updated test payload will now result in failures, since a
base64 encoded string will be compared against a plain text string.

This adds the same logic to `record::record_http` to ensure newly
recorded cassettes match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant